package com.android.task4;


public abstract class TileSource extends Object {
	
	protected String mDisplayName;
	protected int mMaxZoomLevel;
	protected int mMinZoomLevel;
	protected int mDefaultZoomLevel;
	protected String mCachePrefix;
	protected int mTileSize;

	public String getDisplayName() {
		return this.mDisplayName;
	}

	public int getMaxZoomLevel() {
		return this.mMaxZoomLevel;
	}

	public int getMinZoomLevel() {
		return this.mMinZoomLevel;
	}

	public int getDefaultZoomLevel() {
		return this.mDefaultZoomLevel;
	}

	public String getCachePrefix() {
		return this.mCachePrefix;
	}

	public int getTileSize() {
		return this.mTileSize;
	}

	@Override
	public String toString() {
		return "TileSource[" + this.mDisplayName + ";zoom="
				+ this.mMinZoomLevel + "-" + this.mMaxZoomLevel + ","
				+ this.mDefaultZoomLevel + ";cachePrefix=" + this.mCachePrefix
				+ ";tileSize=" + this.mTileSize;
	}

	/***
	 * Returns the resource name for a tile that contains the (x,y) point (in
	 * the map global coordinates) at the given zoom level.
	 * 
	 * @param y
	 *            the y-coordinate.
	 * @param x
	 *            the x-coordinate.
	 * @param zoomLevel
	 *            the zoom level
	 * 
	 * @return the URI of the tile.
	 */
	public abstract String findTileResourceName(final int y, final int x,
			final int zoomLevel);

	/***
	 * Converts a pair of coordinates to a point with a given zoom level.
	 * 
	 * @param coordinates
	 *            the coordinates to convert.
	 * @param zoomLevel
	 *            the zoom level.
	 * @return the converted point.
	 */
	public abstract Point coordinatesToPoint(final Coordinates coordinates,
			final int zoomLevel);

	/***
	 * Converts a point to a pair of coordinates with a given zoom level.
	 * 
	 * @param point
	 *            the point to convert.
	 * @param zoomLevel
	 *            the zoom level.
	 * @return the coordinates.
	 */
	public abstract Coordinates pointToCoordinates(final Point point,
			final int zoomLevel);

	/***
	 * Converts a latitude to the global map y-coordinate at the given zoom
	 * level.
	 * 
	 * @param latitude
	 *            the latitude.
	 * @param zoomLevel
	 *            the zoom level.
	 * @return the y-coordinate.
	 */
	public abstract int latToY(final double latitude, final int zoomLevel);

	/***
	 * Converts a longitude to the global map x-coordinate at the given zoom
	 * level.
	 * 
	 * @param longitude
	 *            the longitude.
	 * @param zoomLevel
	 *            the zoom level.
	 * @return the x-coordinate.
	 */
	public abstract int lonToX(final double longitude, final int zoomLevel);
}
